home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 11 / CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso / cucd / programming / oberonv4 / text / exprusage.text (.txt) < prev    next >
Oberon Text  |  1996-02-28  |  42KB  |  562 lines

  1. Syntax20m.Scn.Fnt
  2. ParcElems
  3. Alloc
  4. Syntax12i.Scn.Fnt
  5. Syntax14m.Scn.Fnt
  6. StyleElems
  7. Alloc
  8. Title
  9. Syntax12.Scn.Fnt
  10. Title
  11. Syntax10.Scn.Fnt
  12. Example
  13. ExprIcons
  14. Alloc
  15. ExprStd
  16. AllocInteger
  17. ExprStd
  18. AllocSymbol
  19. ExprStd
  20. AllocBinaryOp
  21. ExprStd
  22. AllocFunction
  23. ExprLib0
  24. AllocIntegral
  25. P G    ; <
  26. ExprStd
  27. AllocPower
  28. ExprLib0
  29. AllocRoot
  30. ExprLib0
  31. StdConstAlloc
  32. infinity
  33. ExprLib0
  34. AllocLimit
  35. ExprViews
  36. AllocPlaceholder
  37. ExprLib0
  38. AllocGreek
  39. alpha
  40. ExprLib0
  41. AllocFunction
  42. ExprLib0
  43. AllocBinomial
  44. Alpha
  45. Delta
  46. delta
  47. Epsilon
  48. epsilon
  49. Gamma
  50. gamma
  51. Kappa
  52. kappa
  53. Lambda
  54. lambda
  55. Theta
  56. theta
  57. Sigma
  58. sigma
  59. Upsilon
  60. upsilon
  61. Omega
  62. omega
  63. ExprMatrices
  64. Alloc
  65. ExprIcons
  66. AllocGraph
  67. ExprSlang
  68. Alloc
  69. Example
  70. ExprSlang
  71. Alloc
  72. Title
  73. Title
  74. Syntax12m.Scn.Fnt
  75. SubTitle
  76. Example
  77. ExprSlang
  78. Alloc
  79. Example
  80. Example
  81. ExprSlang
  82. Alloc
  83. ExprSlang
  84. Alloc
  85. ExprSlang
  86. Alloc
  87. SubTitle
  88. Example
  89. ExprSlang
  90. Alloc
  91. Example
  92. SubTitle
  93. SubTitle
  94. SubTitle
  95. SubTitle
  96. Example
  97. TableElems
  98. Alloc
  99. Syntax12.Scn.Fnt
  100. StyleElems
  101. Alloc
  102. /nolines "lrtb" /noheads "V" /columns "ccl" /table
  103. primary button    secondary button
  104. left        focus
  105. middle        decompose
  106. middle    left    open
  107. Example
  108. Syntax12.Scn.Fnt
  109. StyleElems
  110. Alloc
  111. /nolines "lrtb" /noheads "V" /columns "ccl" /table
  112. primary button    secondary button
  113. right        set subselection
  114. right    left    replace subselection by least recent selection
  115. right    middle    copy-over subselection to focus
  116. Title
  117. Title
  118. Example
  119. Example
  120. ExprSlang
  121. Alloc
  122. Title
  123. Example
  124. ExprSlang
  125. Alloc
  126. Example
  127. ExprSlang
  128. Alloc
  129. ExprSlang
  130. Alloc
  131. ExprSlang
  132. Alloc
  133. Example
  134. ExprSlang
  135. Alloc
  136. ExprSlang
  137. Alloc
  138. ExprSlang
  139. Alloc
  140. ExprSlang
  141. Alloc
  142. ExprSlang
  143. Alloc
  144. LineElems
  145. Alloc
  146. Example
  147. ExprSlang
  148. Alloc
  149. ExprSlang
  150. Alloc
  151. ExprSlang
  152. Alloc
  153. ExprSlang
  154. Alloc
  155. Example
  156. ExprSlang
  157. Alloc
  158. Example
  159. Example
  160. ExprSlang
  161. Alloc
  162. ExprSlang
  163. Alloc
  164. Title
  165. Title
  166. Table
  167. ExprSlang
  168. Alloc
  169. ExprSlang
  170. Alloc
  171. ExprSlang
  172. Alloc
  173. ExprSlang
  174. Alloc
  175. ExprSlang
  176. Alloc
  177. ExprSlang
  178. Alloc
  179. ExprSlang
  180. Alloc
  181. ExprSlang
  182. Alloc
  183. ExprSlang
  184. Alloc
  185. ExprSlang
  186. Alloc
  187. ExprSlang
  188. Alloc
  189. ExprSlang
  190. Alloc
  191. ExprSlang
  192. Alloc
  193. ExprSlang
  194. Alloc
  195. ExprSlang
  196. Alloc
  197. ExprSlang
  198. Alloc
  199. ExprSlang
  200. Alloc
  201. ExprSlang
  202. Alloc
  203. ExprSlang
  204. Alloc
  205. ExprSlang
  206. Alloc
  207. ExprSlang
  208. Alloc
  209. ExprSlang
  210. Alloc
  211. ExprSlang
  212. Alloc
  213. ExprSlang
  214. Alloc
  215. Table
  216. ExprSlang
  217. Alloc
  218. ExprSlang
  219. Alloc
  220. ExprSlang
  221. Alloc
  222. ExprSlang
  223. Alloc
  224. ExprSlang
  225. Alloc
  226. ExprSlang
  227. Alloc
  228. ExprSlang
  229. Alloc
  230. ExprSlang
  231. Alloc
  232. ExprSlang
  233. Alloc
  234. ExprSlang
  235. Alloc
  236. ExprSlang
  237. Alloc
  238. ExprSlang
  239. Alloc
  240. ExprSlang
  241. Alloc
  242. ExprSlang
  243. Alloc
  244. ExprSlang
  245. Alloc
  246. ExprSlang
  247. Alloc
  248. ExprSlang
  249. Alloc
  250. ExprSlang
  251. Alloc
  252. ExprSlang
  253. Alloc
  254. ExprSlang
  255. Alloc
  256. ExprSlang
  257. Alloc
  258. ExprSlang
  259. Alloc
  260. ExprSlang
  261. Alloc
  262. ExprSlang
  263. Alloc
  264. ExprSlang
  265. Alloc
  266. ExprSlang
  267. Alloc
  268. ExprSlang
  269. Alloc
  270. ExprSlang
  271. Alloc
  272. ExprSlang
  273. Alloc
  274. ExprSlang
  275. Alloc
  276. ExprSlang
  277. Alloc
  278. ExprSlang
  279. Alloc
  280. ExprSlang
  281. Alloc
  282. ExprSlang
  283. Alloc
  284. ExprSlang
  285. Alloc
  286. ExprSlang
  287. Alloc
  288. ExprSlang
  289. Alloc
  290. ExprSlang
  291. Alloc
  292. ExprSlang
  293. Alloc
  294. ExprSlang
  295. Alloc
  296. ExprSlang
  297. Alloc
  298. ExprSlang
  299. Alloc
  300. ExprSlang
  301. Alloc
  302. ExprSlang
  303. Alloc
  304. ExprSlang
  305. Alloc
  306. ExprSlang
  307. Alloc
  308. ExprSlang
  309. Alloc
  310. ExprSlang
  311. Alloc
  312. Table
  313. Title
  314. Table
  315. ExprSlang
  316. Alloc
  317. ExprSlang
  318. Alloc
  319. ExprSlang
  320. Alloc
  321. Table
  322. Title
  323. Example
  324. ExprSlang
  325. Alloc
  326. Example
  327. ExprSlang
  328. Alloc
  329. Example
  330. ExprSlang
  331. Alloc
  332. Example
  333. ExprSlang
  334. Alloc
  335. ExprSlang
  336. Alloc
  337. Example
  338. ExprSlang
  339. Alloc
  340. Example
  341. ExprSlang
  342. Alloc
  343. Example
  344. ExprSlang
  345. Alloc
  346. Example
  347. ExprSlang
  348. Alloc
  349. Example
  350. ExprSlang
  351. Alloc
  352. Example
  353. ExprSlang
  354. Alloc
  355. ExprSlang
  356. Alloc
  357. ExpressionIcons - User's Guide
  358. Wolfgang Weck
  359. Institute for Scientific Computing
  360. ETH Z
  361. Weck@inf.ethz.ch
  362. Introduction
  363. ExpressionIcons are an extension of the Oberon text system which allows for representation and editing of mathematical expressions while floating within text documents. Expressions can be transformed seamlessly between textual and iconized representation. In particular, an expression can be represented in a mixed way. Since conversions between text and icons are very simple, the text editor can be used as the basic tool for editing while the icons provide two dimensional graphical visualization. The effort spent in acquainting is reduced dramatically, given that the user is familiar with the text editor. Further, selections of subexpressions within ExpressionIcons are supported. These integrate the copy_over facility of the text framework, allowing for graphic oriented editing as an alternative.
  364. The underlying internal data structure for expressions forms an abstract data type. It is a powerful basis for any computation command. Expressions represented as ExpressionIcons can easily be used to interface such commands, i.e. to represent input as well as output. The distinction between text generated from such commands or by the user becomes obsolete, so does the separation of input and output of commands. Usually, commands can operate on expressions represented in any mixed form (text and icons) as well as on subexpressions selected within an icon. There is no need to convert text to an icon before activating a command.
  365. In the case of huge formulae elision is used to reduce the space needed. Entire subexpressions will become hidden, showing three dots instead. The user still can see the overall structure of the expression without loosing the overview. To zoom into subexpressions partial convertion to text is used to retrieve a new icon representing only the subexpression in question but displaying more details.
  366. This document gives an introduction to the usage of ExpressionIcons. It is assumed that the reader is familiar with text editing in Oberon. It is explained how expressions can be generated, edited, and used as input for commands. This document tries to be readable in both a static form (e.g. printed on paper) as well as in an interactive form on the computer screen. In case of the latter, the reader is encouraged to experiment with the expressions given as examples.
  367. Elision
  368. It is quite often impossible to display an expression generated by Computer Algebra in its full size and to every detail. On one hand, screen size (or paper size) limits the space availlable; on the other hand details would be shown too small to be readable. Still, the user's needs may vary between getting the overview and looking at a specific detail. These two extremes - and anything between - should be supported in some way.
  369. ExpressionIcons use a top down approach: Of a large expression the overall structure is visible, details are collapsed and displayed as an elision (three dots - occasionally presenting a number giving the size of the folded part). This allows to see immediately, that something is e.g. a sum of integrals, or an even integer with 134 digits:
  370. To get information about a specific detail of an expression like this, one should use one of the methods described below, to zoom in. (E.g. to see all the digits of the integer number, you may open the icon, by performing an middle-left-interclick with the mouse on the icon.)
  371. The level of elision, i.e. the degree of detail used for representation, can be set individually for each ExpressionIcon.
  372. Placeholders
  373. Placeholders are a special kind of expressions. They do not have a value assigned and are all equivalent with each other. They are displayed as question_marks. Placeholders do not have a textual representation. Therefore, they can neither be typed in nor can an icon representing just a Placeholder be converted to text. New Placeholders can be generated with the command ExprTools.NewPlaceholder which inserts an icon representing a Placeholder at the current insertion point.
  374. Placeholders are used as special marks with certain operations. Most important is their usage with copy_over (see below) to resemble Overlays.
  375. Mouse Commands on ExpressionIcons
  376. In the first place, ExpressionIcons act as parts of a text. The mouse commands of the text editor can be used to copy, delete, or change attributes of ExpressionIcons. Some mouse commands are handled specially by ExpressionIcons. These are described in the following.
  377. Decomposition
  378. Clicking the middle button of the mouse on an ExpressionIcon causes the icon to decompose itself into text on the highest structural level of the expression represented. An ExpressionIcon representing e.g. a product of powers will be rewritten as a sequence of ExpressionIcons representing the individual factors with asterisk characters between them:
  379. clicking the middle mouse button leads to
  380. This operation can be used to decompose a specific part of an expression into text allowing for editing. To convert a text back to an ExpressionIcon select the text in question and execute the ExprTools.Collapse command. To convert an Expression entirely to text, not only the first level, use one of the commands ExprTools.ConvertToText or ExprTools.Write (see below).
  381. Opening
  382. Clicking the middle mouse button on an ExpressionIcon and interclicking the left button before releasing the mouse buttons opens the icon: The textual decomposition as described in the previous section will be shown in a separate viewer which is opened. The original ExpressionIcon remains unchanged. The text displayed can be edited, using the normal text editing operations of the Oberon System. The command Icons.Update in the menu bar of the viewer can be used to update the icon opened in the first place. It is not necessary to convert the text in the viewer itself into an ExpressionIcon before.
  383. This facility can be used to get an extra scratch pad for expression editing. It allows to decompose parts of the expression without corrupting the original document. Further, it allows to cancel an editing operation, simply by not updating the icon. Another application is to get a quick insight into an expression with elisions.
  384. click middle mouse button, interclick left mouse button
  385. If an ExpressionIcon that holds a subselection (see below) is opened, only the selected subexpression is shown in the viewer. Also, an update will affect only this subexpression. This is especially helpful when dealing with large expressions.
  386. Focusing
  387. The operations described in the following sections use selections within an ExpressionIcon, so called subselections. Before any subselection can be made, the corresponding icon has to be focused by clicking the left mouse button on it. After releasing the mouse button, a dotted frame is displayed surrounding the icon. After this, any of the following operations can be executed.
  388. Making Subselections
  389. Most of the commands operating on expressions can operate either on text, a text selection, or a subselection. A subselection is the selection of a subexpression within an ExpressionIcon. Operations on subselections will change the value of the selected subexpression only.
  390. To set a subselection, first focus the icon holding the expression in question by clicking the left mouse button on it. Afterwards you can set a selection within the framed icon, by pressing the right mouse button and holding it while moving the mouse around. As for text, the selected subexpression is displayed in an inverted mode.
  391. Only entire substructures of an expression can be selected. E.g. from a sum with several terms one can either select one of the individual terms or the entire sum, but not a partial sum.
  392. Selected subexpressions might be used as input to a command or with the copy_over facility of Oberon's text system. A subselection might also be used before opening an icon to display a specific subexpression only.
  393. Copy_Over
  394. Besides for copying entire ExpressionIcons as atoms, the copy_over facility of Oberon's text system can also be used to copy subexpressions. This is achieved by the fact, that any expression can be seen as text - e.g. as one single icon, representing this expression. Hence, a selected subexpression also has a textual appearance. On the other hand, if any selected piece of text can be interpreted as a valid expression, it can be converted and stored as a subexpression. From these considerations follows, that all combinations of copying between text and subexpressions are possible.
  395. Unlike the text system, where the insertion point (caret) and selections are handled separately, subselections within ExpressionIcons serve as both simultaneously. This is due to the underlying expression model, which allows as its only operation the replacement of entire subexpressions by complete and valid expressions.
  396. Focusing an ExpressionIcon (see above) makes it the target for copy_over operations. If several ExpressionIcons are focussed at the same time, the target is the least recent focused one of those. If this target holds a subselection, copying a piece of text or another subexpression with a right_middle_interclick will replace the selected subexpression.
  397. Interclicking the left mouse button while selecting within a focussed icon will lead to the replacement with the finally selected subexpression by the least recent previous selection - no matter whether the latter is a text selection or a subselection.
  398. Important note: It is not possible within one viewer to have two icons focused at the same time nor to have a focused icon and a text selection. Use the System.Copy-command to generate a second viewer before using copy_over within a single document.
  399. Placeholders have a special role when used in the source to copy_over into a subexpression: As described above, if the target is a subselection, the selected subexpression will be replaced by the source. If the source, i.e. the replacement for the subselection, contains Placeholders, all of them are replaced by the selected target expression. If the source does not contain any Placeholder, the old expression is discarded. The application of this is mainly to create overlays in contrast to templates. For a description of these concepts see the section How to produce an ExpressionIcon bellow.
  400. Summary of Mouse Commands
  401. On unfocused ExpressionIcons the usual mouse commands of the hosting text editor can be used. Additionally the following operations as described above are available:
  402. On ExpressionIcons being focused before and surrounded by a dotted frame the commands for subselections can be used:
  403. How to Convert ExpressionIcons to Text
  404. There exist four general ways to convert an expression represented by an ExpressionIcon into text. An icon can either be decomposed with a click of the middle button or opened it with an middle-left-interclick. Both operations will produce a text where larger subexpressions are still represented as icons. Decomposition replaces the original icon by that text but opening openes an additional viewer presenting a text editor.
  405. An expression can entirely be converted to text either by recursive application of decomposition or by one of the commands ExprTools.ConvertToText and ExprTools.Write. Both act on the least recent selection. Whereas ExprTools.ConvertToText replaces the icon by the text, ExprTools.Write will leave the icon unchanged and produce a new text stretch at the position of the current focus. If the current focus is an subselection in an icon, it will act like copy_over.
  406. A text converted from an icon may contain some unnecessary parentheses. To get rid of a pair of extra parentheses in a text, one can select the opening parenthesis and execute the command ExprTools.RemovePar. But be aware, that this operation might change the meaning of your expression!
  407. The Text Representation of Expressions
  408. In the plain text form expressions are represented as a linear sequence of characters. ExpressionIcons within such a sequence represent subexpression. For the rest, the meaning of the text is defined by a special extensible language. In the core system the syntax of this language is fixed as follows:
  409. equation := expr [ "=" expr].
  410. expSeq := equation {"," equation}.
  411. index := "[" expSeq "]".
  412. expr := ["-"] term {addop term}.
  413. term := factor {mulop factor}.
  414. factor := {atom "^"} atom.
  415. atom := ("(" equation ")" | function | collection | symbol | integer | subExpression) [index].
  416. function := name "(" [expSeq] ")".
  417. collection := "{" [expSeq] "}".
  418. symbol := name.
  419. name := letter {letter | digit}.
  420. integer := digit {digit}.
  421. The default parser, used to form ExpressionIcons or to read input to commands, tries to read its input as an equation.
  422. The set of expressions is extended by a postprocessor that transforms specific expressions into others. In most cases, special named functions are used for that purpose. A set of standard extensions is defined in the ExprLib0 module, e.g. Integral expressions. They have two representations, a two dimensional one and one as a function:
  423. The exact binding of function names and expressions needs to be defined in the corresponding extension. For the definition of the expressions defined in the ExprLib0 module see the corresponding section below.
  424. How to produce an ExpressionIcon
  425. The equivalent of entering an expression into a classical expression editor is to produce an ExpressionIcon. There are two general ways to do so but any combination of these is possible and it is left to the user and his or her creativity to find the way suiting best both user's skill and situation's demands.
  426. One simple way to enter an expression is to type it on the keyboard. The resulting text can be used as input to any command. Simply converting the text into an icon can be considered as a special case of this and is achieved through the command ExprTools.Collapse ^. However, to be able to type in a complicated expression, the user is required to get some knowledge about the textual representation of the parts to be used. To type in the following expression for instance
  427. requires knowledge about the representation of limits and integrals as functions. The text to type for the example above would be
  428.     limit(int(x^(1 / n), x, 0, const(infinity)), x, 0, 1).
  429. If the textual representation of some or all expressions involved is unknown, a mouse_driven method based on templates or on overlays might be used. Both cases employ the copy_over facility and a palette of prepared patterns (like the one stored in ExprPalette.Text). Since thus palettes can be realized as texts, they exhibit the same flexibility as tool texts in the Oberon system. These approaches are easy to use and do not require any extra knowledge besides usage of the copy_over facility.
  430. The difference between templates and overlays is that in case of the former a pattern is simply copied unchanged, whereas overlays modify an already existing expression. As an example for the latter consider an expression like 
  431.  that should be transformed into 
  432. . This can be achieved by copying the overlay pattern 
  433.  onto the fraction.
  434. As an example for the usage of templates it is shown below how to compose a new formula from the following patterns:
  435.    ->    
  436.    ->    
  437.    ->    
  438.    ->
  439. Note, that when opening a copied template for editing the comparison of the subexpressions in the opened text and the template itself will guide the user to identify the order of the function parameter. E.g., when opening integral template from the example above one will see
  440.     int(f(x), x, a, b)
  441. and immediately recognize that the order of the parameters are integrand, integration variable, lower bound, and upper bound. Obviously it is a good idea to use such different symbols in a template. For that reason the following is considered to be a poorly designed template:
  442. As mentioned before, any mixture of these techniques can be applied. E.g. one might copy the limit template, because the textual representation is currently unknown, open the new icon, delete the argument 
  443.  and replace it by a typed expression representing the integral...
  444. Extensions and Automatic Substitutions
  445. The set of representable expressions is extensible. New modules might be provided implementing additional expression types. Most such modules will offer two representations for the expression types they define: One customized to represent the expression in a two dimensional way and one in the standard language, as understood by the standard parser. Most of the time special function names will be defined and all subexpressions will be given as a parameter to this function.
  446. Normally such a module will install an automatic substitution mechanism upon loading. Thus, whenever the standard parser is used to read input, the extended expression types are used automatically. Also, when converted to text, the special expressions will be converted back to their representation in the standard language gradually. Although there are commands to do these things manually, the automatic transformations will suit most of the user's purposes.
  447. Two extension modules being part of the standard system are described in the following.
  448. The Lib0 Extensions
  449. The following list shows for each of the expressions implemented in module ExprLib0 the templates and the corresponding representation as a function in the standard language:
  450.     abs(x)    
  451.     norm(x)
  452.     ceiling(x)    
  453.     floor(x)
  454.     factorial(x)    
  455.     gamma(x)
  456.     binomial(x, y)
  457.     int(
  458. , x)    
  459.     int(
  460. , x, a, b)
  461.     limit(
  462. , x, 0, 0)
  463.     limit(
  464. , x, 0, 1)    
  465.     limit(
  466. , x, 0, -1)
  467.     const(pi)    
  468.     const(e)
  469.     const(infinity)
  470. The function greek with one argument is interpreted as a symbol to be represented as a greek letter:
  471.     greek(Alpha)    
  472.     greek(alpha)
  473.     greek(Beta)    
  474.     greek(beta)
  475.     greek(Chi)    
  476.     greek(chi)
  477.     greek(Delta)    
  478.     greek(delta)
  479.     greek(Epsilon)    
  480.     greek(epsilon)
  481.     greek(Gamma)    
  482.     greek(gamma)
  483.     greek(Eta)    
  484.     greek(eta)
  485.     greek(Iota)    
  486.     greek(iota)
  487.     greek(Phi)    
  488.     greek(phi)
  489.     greek(Kappa)    
  490.     greek(kappa)
  491.     greek(Lambda)    
  492.     greek(lambda)
  493.     greek(Mu)    
  494.     greek(mu)
  495.     greek(Nu)    
  496.     greek(nu)
  497.     greek(O)    
  498.     greek(o)
  499.     greek(Pi)    
  500.     greek(pi)
  501.     greek(Theta)    
  502.     greek(theta)
  503.     greek(Rho)    
  504.     greek(rho)
  505.     greek(Sigma)    
  506.     greek(sigma)
  507.     greek(Tau)    
  508.     greek(tau)
  509.     greek(Upsilon)    
  510.     greek(upsilon)
  511.     greek(Omega)    
  512.     greek(omega)
  513.     greek(Xi)    
  514.     greek(xi)
  515.     greek(Psi)    
  516.     greek(psi)
  517.     greek(Zeta)    
  518.     greek(zeta)
  519. All these extensions are made available for automatic usage by the standard parser upon module loading. The module is loaded as soon as a document is opened, that contains at least one of the expressions implemented in ExprLib0, e.g. the ExprPalette.Text or this document. It can also be loaded explicitly by executing one of the commands listed below. These commands install resp. remove the automatic conversion by the standard parser for specific expression types. Note however, that upon loading the module all extensions defined are installed simultaneously, no matter which command was executed. Also note, that these commands will only change the behavior of the standard parser but not affect expressions already in existence.
  520. ExprLib0.InstallConsts    ExprLib0.RemoveConsts
  521. ExprLib0.InstallBinomials    ExprLib0.RemoveBinomials
  522. ExprLib0.InstallGreeks    ExprLib0.RemoveGreeks
  523. ExprLib0.InstallFunctions    ExprLib0.RemoveFunctions
  524. ExprLib0.InstallRoots    ExprLib0.RemoveRoots
  525. ExprLib0.InstallIntegrals    ExprLib0.RemoveIntegrals
  526. ExprLib0.InstallLimits    ExprLib0.RemoveLimits
  527. The Matrix Extension
  528. The module ExprMatrices implements a further expression, a construct to represent matrices. Vectors might be represented as matrices of height 1 resp. width 1. Examples:
  529.     matrix(1, 4, a, b, c, d)    
  530.     matrix(4, 1, a, b, c, d)
  531.     matrix(2, 2, a, b, c, d)
  532. Like the extensions defined in module ExprLib0 the automatic conversion for the matrix extension is installed either by opening a document containing a matrix or by executing a command from the module:
  533. ExprMatrices.Install    ExprMatrices.Remove
  534. The ExprTools commands
  535. The module ExprTools serves as a user interface and offers a collection of commands. These are described in this section:
  536. ExprTools.Iconize n ^    n being an (optional) positive integer;    focus (caret) needs to be set
  537. A new ExpressionIcon representing the least recent selected expression is generated and inserted at the current focus position (caret). The selection might be a text stretch as well as a subselection in an already existing ExpressionIcon. The number n gives the level of representation before elision is used for the new icon; if omited a default value is used.
  538. ExprTools.Collapse n ^    n being an (optional) positive integer
  539. The least recent subselection is parsed, interpreted as an expression, and replaced by an ExpressionIcon. If the least recent selection is a subselection within an icon, the automatic substitutions are applied to the corresponding subexpression without further changes. The number n gives the level of representation for the new icon; if omited a default value is used.
  540. This command might also be used to set the level of representation to a specific value and to apply the automatic substitutions to an already existing ExpressionIcon. If the command is applied to a text stretch with several expressions, the operation is applied to each of them individually.
  541. ExprTools.Write ^    focus (caret) needs to be set
  542. Generates are purely textual representation of the selected expression and copies it to the current focus position. The selection is not affected.
  543. ExprTools.ConvertToText ^
  544. Replaces the current selected expression by its textual representation. Has no effect on subselections. If the command is applied to a text stretch with several ExpressionIcons, the operation is applied to each of them individually.
  545. ExprTools.IncDepth n ^    n being a signed integer
  546. The level of representation is incremented for all ExpressionIcons within the least recent selected text stretch according to n. A negative number reduces the amount of visible data whereas a positive number increases it.
  547. ExprTools.Substitute e1 => e2 ~    e1 and e2 being expressions
  548. All subexpressions being equal to e1 are replaced by e2 in the least recently selected (sub_)expression. Besides others, this command can be used to do common subexpression elimination and to substitute back:
  549. ExprTools.Substitute 
  550.  => w
  551. ExprTools.Substitute w => 
  552.  s => 
  553. ExprTools.TestEquation ^    an equation needs to be selected
  554. A statement is written to the log text, saying wether the equations holds. Note that no mathematical transformations are applied. In case of commuting operands (e.g. terms in sums) commutation is taken into account. Associativity is not considered. An expression claimed to hold will always hold, whereas the statement that an equation does not hold simply means that the command was not able to find a way to transform both sides to a unique representation by simple means.
  555.     equation holds
  556.     equation does not hold
  557.         equation holds
  558.         equation does not hold
  559. ExprRatCalc.Simplify ^
  560. Simplifies the least recent selected expressions and its subexpression by performing rational computations, as far as possible.
  561. ExprRatCalc.Simplify
  562.